<template>
<view class="chain_div flex_w flex_sb">
	<view class="chain_item" v-for="(item,index) in chainList" :key="index" @click="toPage(item)">
		<image :src="item.chain_img||'https://wqq103910.oss-cn-hangzhou.aliyuncs.com/images/fuzhou/image/1666329611955.jpg'" mode=""></image>
		<view class="">{{item.chain_name}}</view>
	</view>
</view>
</template>

<script>
	import { myIndustrychain } from '@/utils/api.js'
	export default {
		data() {
			return {
				chainList:uni.getStorageSync('myChain')
			}
		},
		methods: {
			toPage(item){
				myIndustrychain({chain_id:item.id,id:uni.getStorageSync('role_id')}).then(res=>{
					if(res.data.length>0){
						uni.navigateTo({
							url:'/pages/chainDetail/chainDetail?chain='+JSON.stringify(item)
						})
					}else{
						uni.showToast({
							title:'该产业链规划中',
							icon:'none'
						})
					}
				})
			}
		}
	}
</script>

<style scoped lang="scss">
.chain_div{
	width: calc(100% - 20px);
	margin:  0 10px;
	padding: 10px 0;
}
.chain_item{
	width: calc(50% - 8px);
	margin-bottom: 15px;
	box-shadow: 0 2px 6px 0 rgba(0, 0, 0, 0.3);
	border-radius: 6px;
	overflow: hidden;
	image{
		width: 100%;
		height: 90px;
	}
	view{
		padding: 0px 10px 5px;
	}
}
</style>
